/****************************************************************************
 * @file    FloraIniManager.cpp
 * @brief   Implementation of the FloraIniManager class.
 * @details This file contains the implementation of the FloraIniManager class,
 *          which provides methods to read and write configuration values
 *          from and to an INI file.
 *
 * @author  繁花遁
 * @date    2024-08-30
 ****************************************************************************/

#include "FloraIniManager.h"

// Constructor
FloraIniManager::FloraIniManager(const QString &filePath) : settings(filePath, QSettings::IniFormat) {}

// Get methods
bool FloraIniManager::getBool(const QString &section, const QString &key) {
    return settings.value(section + "/" + key).toBool();
}

int FloraIniManager::getInt(const QString &section, const QString &key) {
    return settings.value(section + "/" + key).toInt();
}

QString FloraIniManager::getString(const QString &section, const QString &key) {
    return settings.value(section + "/" + key).toString();
}

QStringList FloraIniManager::getStringList(const QString &section, const QString &key) {
    return settings.value(section + "/" + key).toStringList();
}

// Set methods
void FloraIniManager::setValue(const QString &section, const QString &key, bool value) {
    settings.setValue(section + "/" + key, value);
}

void FloraIniManager::setValue(const QString &section, const QString &key, int value) {
    settings.setValue(section + "/" + key, value);
}

void FloraIniManager::setValue(const QString &section, const QString &key, const QString &value) {
    settings.setValue(section + "/" + key, value);
}

void FloraIniManager::setValue(const QString &section, const QString &key, const QStringList &value) {
    settings.setValue(section + "/" + key, value);
}
